package com.tea.constans;

import com.tea.service.UserService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * OpenId验证工具类
 */
@Component
public class OpenId {
    
    @Resource
    private UserService userService;

    /**
     * 验证给定的openId是否在允许的列表中
     * @param openId 微信小程序openId
     * @return 是否有效
     */
    public boolean isValid(String openId) {
        return userService.isValidOpenId(openId);
    }
}